import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '@/views/Home'
import store from "@/store";
Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: {
      keepAlive: true // 需要缓存
    }
  },
  {
    path: "/404",
    name: "404",
    component: () => import("@/views/404"),
    hidden: true
  },
  {
    path: '/workOrder',
    name: 'WorkOrderIndex',
    component: () => import('@/views/WorkOrderIndex')
  },
  {
    path: '/chapterApplyIndex',
    name: 'ChapterApplyIndex',
    component: () => import('@/views/ChapterApplyIndex')
  },
  {
    path: '/yhjy',
    name: 'Yhjy',
    component: () => import('@/views/Yhjy')
  },
  {
    path: '/version',
    name: 'Version',
    component: () => import('@/views/Version')
  },
  {
    path: '/partyBuildingVideo/:data',
    name: 'PartyBuildingVideoIndex',
    component: () => import('@/components/partyBuildingVideo/Index')
  },
  {
    path: '/zxNavigationPageDetail',
    name: 'ZxNavigationPageDetail',
    component: () => import('@/views/ZxNavigationPageDetail')
  },
  {
    path: '/pilotPreach',
    name: 'PilotPreach',
    component: () => import('@/components/partyBuildingVideo/PilotPreach')
  },
  {
    path: '/redBase/:navIOSColor',
    name: 'RedBase',
    component: () => import('components/redBase/index.vue'),
    meta:{
      navShow:true,
    },
    children: [
      {
        path: '/theDetailedContent',
        name: 'TheDetailedContent',
        component: () => import('@/components/redBase/TheDetailedContent'),
        meta:{
          navShow:false,
        }
      },
    ]
  },
  {
    path: '/PartyBranchWork',
    name: 'PartyBranchWork',
    component: () => import('@/components/workReminders/index'),
    redirect: function (to){
      return store.state.thePartyBranch321.ziLuBy[0].path
    },
    children: [
        {
          path: "/SaveTheCompanyIssued",
          name: "SaveTheCompanyIssued",
          component: () => import('@/components/workReminders/SaveTheCompanyIssued'),
          meta:{
            navShow:true,
          }
       },
        {
          path: "/DirectlyUnderThePartyCommitteeIssued",
          name: "DirectlyUnderThePartyCommitteeIssued",
          component: () => import('@/components/workReminders/DirectlyUnderThePartyCommitteeIssued'),
          meta:{
            navShow:true,
          }
       },
        {
          path: "/CityWorkList",
          name: "CityWorkList",
          component: () => import('@/components/workReminders/CityWorkList'),
          meta:{
            navShow:true,
          }
       },
       {
          path: "/BranchTask",
          name: "BranchTask",
          component: () => import('@/components/workReminders/BranchTask'),
          meta:{
            navShow:true,
          }
       },
       {
          path: "/TheDetailedInformation",
          name: "TheDetailedInformation",
          component: () => import('@/components/workReminders/TheDetailedInformation'),
          meta:{
            navShow:false,
          }
       },
    ]
  },
  {
    path: '/meetingList',
    name: 'MeetingList',
    component: () => import('@/components/home/meetingManagement/MeetingList')
  }
]

const router = new VueRouter({
  routes
})

const originalPush = VueRouter.prototype.push;
// push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch(err => err);
};


export default router
